package com.sikaryofficial.system.api;

import com.sikaryofficial.common.core.constant.ServiceNameConstants;
import com.sikaryofficial.common.core.domain.R;
import com.sikaryofficial.common.core.web.domain.PageResult;
import com.sikaryofficial.system.api.factory.RemoteArticleFallbackFactory;
import com.sikaryofficial.system.api.model.infomation.ArticleDTO;
import com.sikaryofficial.system.api.model.infomation.ArticleListReq;
import com.sikaryofficial.system.api.model.infomation.KolListReq;
import com.sikaryofficial.system.api.model.infomation.StatuteListReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 文章服务
 *
 * @author qinjinyuan
 */
@FeignClient(contextId = "remoteArticleService", value = ServiceNameConstants.INFORMATION_SERVICE, fallbackFactory = RemoteArticleFallbackFactory.class)
public interface RemoteArticleService {
    /**
     * 查询文章列表
     */
    @PostMapping("/article/listPage")
    PageResult<ArticleDTO> listPage(@Validated @RequestBody ArticleListReq req);
    /**
     * 查询法律法规列表
     */
    @PostMapping("/article/statuteListPage")
    PageResult<ArticleDTO> statuteListPage(@Validated @RequestBody StatuteListReq req);
    /**
     * 查询kol列表
     */
    @PostMapping("/article/kolListPage")
    PageResult<ArticleDTO> kolListPage(@Validated @RequestBody KolListReq req);
    /**
     * 获取文章详细信息
     */
    @GetMapping(value = "/article/{articleId}")
    R<ArticleDTO> getInfo(@PathVariable(value = "articleId") Long articleId);

    @GetMapping(value = "/article/simple/{articleId}")
    R<ArticleDTO> getSimpleInfo(@PathVariable(value = "articleId") Long articleId);

    /**
     * 删除文章
     */
    @GetMapping("/article/delete/{articleIds}")
    R<Boolean> remove(@PathVariable(value = "articleIds") String articleIds);

    /**
     * 删除个人文章
     * @param articleIds
     * @return
     */
    @GetMapping("/article/removeOwner/{articleIds}")
    R<Boolean> removeOwner(@PathVariable(value = "articleIds") String articleIds);

    /**
     * 个人最新发布文章列表
     * @return
     */
    @GetMapping("/article/owner/latest")
    R<List<ArticleDTO>> ownerLatest();
}
